$primary: var(--primary, #19b394);
$primary-foreground: var(--primary-foreground, #fff);
$primary-light: var(--primary-light, rgba(25, 179, 148, 0.1));

$background: var(--background, #fff);
$background-dim: var(--background-dim, #f3f3f3);
//todo: discuss this variable
$foreground-disabled: var(--foreground-disabled, rgba(#161616, 0.16));

$base-unit: var(--base-unit, 8px);
@function calcSize($multiplier) {
  $result: calc(#{$multiplier} * #{$base-unit});
  @return $result;
}

sv-popup {
  display: block;
  position: absolute;
  z-index: -1;
}
.sv-popup {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
}
.sv-popup--modal {
  display: flex;
  align-items: center;
  justify-content: center;
  .sv-popup__container {
    position: static;
    filter: none;
    padding: calcSize(4);
  }
}
.sv-popup__container {
  position: absolute;
  filter: drop-shadow(0px calcSize(1) calcSize(2) rgba(0, 0, 0, 0.1));
  padding: calcSize(1) 0;
  background: $body-background-color;
  border-radius: 4px;
}
.sv-popup__scrolling-content {
  max-width: 90vh;
  max-height: 90vh;
  overflow: auto;
  &::-webkit-scrollbar {
    height: 6px;
    width: 6px;
    background-color: $background-dim;
  }
  &::-webkit-scrollbar-thumb {
    background: $primary-light;
  }
}
.sv-popup__content {
  min-width: 100%;
}
.sv-popup--show-pointer.sv-popup--top {
  transform: translateY(calcSize(-1));
  .sv-popup__pointer {
    transform: translate(calcSize(-1)) rotate(180deg);
  }
}
.sv-popup--show-pointer.sv-popup--bottom {
  transform: translateY(calcSize(1));
  .sv-popup__pointer {
    transform: translate(calcSize(-1), calcSize(-1));
  }
}
.sv-popup--show-pointer.sv-popup--right {
  transform: translate(calcSize(1));
  .sv-popup__pointer {
    transform: translate(-12px, -4px) rotate(-90deg);
  }
}
.sv-popup--show-pointer.sv-popup--left {
  transform: translate(calcSize(-1));
  .sv-popup__pointer {
    transform: translate(-4px, -4px) rotate(90deg);
  }
}
.sv-popup__pointer {
  display: block;
  position: absolute;
  &:after {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-left: calcSize(1) solid transparent;
    border-right: calcSize(1) solid transparent;
    border-bottom: calcSize(1) solid $body-background-color;
    align-self: center;
  }
}
.sv-popup__footer {
  display: flex;
  margin-top: calcSize(4);
}
.sv-popup__footer-item:first-child {
  margin-left: auto;
}
.sv-popup__footer-item + .sv-popup__footer-item {
  margin-left: calcSize(1);
}
.sv-popup__button {
  padding: calcSize(2) calcSize(6);
  background: $background;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  margin: 2px;
  cursor: pointer;

  font-family: $font-family;
  font-style: normal;
  font-weight: 600;
  font-size: calcSize(2);
  line-height: calcSize(3);
  text-align: center;
  color: $primary;

  border: none;
  &:hover {
    box-shadow: 0 0 0 2px $primary;
  }
  outline: none;
}
.sv-popup__button:disabled {
  color: $foreground-disabled;
  cursor: default;
  &:hover {
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);
  }
}
.sv-popup__button--apply {
  background-color: $primary;
  color: $primary-foreground;
}
.sv-popup__button--apply:disabled {
  background-color: $background-dim;
}
